home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / aros / source / exec / messages / src / replymsg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-16  |  1.8 KB  |  93 lines

  1. /*
  2.     $Id$
  3.     $Log$
  4.     Desc:
  5.     Lang: english
  6. */
  7. #include "exec_intern.h"
  8. #include <exec/ports.h>
  9.  
  10. /*****************************************************************************
  11.  
  12.     NAME */
  13.     #include <clib/exec_protos.h>
  14.  
  15.     __AROS_LH1(void, ReplyMsg,
  16.  
  17. /*  SYNOPSIS */
  18.     __AROS_LA(struct Message *, message, A1),
  19.  
  20. /*  LOCATION */
  21.     struct ExecBase *, SysBase, 63, Exec)
  22.  
  23. /*  FUNCTION
  24.     Send a message back to where it came from. It's generally not
  25.     wise to access the fields of a message after it has been replied.
  26.  
  27.     INPUTS
  28.     message - a message got with GetMsg().
  29.  
  30.     RESULT
  31.  
  32.     NOTES
  33.  
  34.     EXAMPLE
  35.  
  36.     BUGS
  37.  
  38.     SEE ALSO
  39.     WaitPort(), GetMsg(), PutMsg()
  40.  
  41.     INTERNALS
  42.  
  43.     HISTORY
  44.     29-10-95    digulla automatically created from
  45.                 exec_lib.fd and clib/exec_protos.h
  46.     17-12-95    digulla Incorporated code by Matthias Fleischner
  47.  
  48. *****************************************************************************/
  49. {
  50.     __AROS_FUNC_INIT
  51.     struct MsgPort *port;
  52.  
  53.     /* Protect the message against access by other tasks. */
  54.     Disable();
  55.  
  56.     /* Get replyport */
  57.     port=message->mn_ReplyPort;
  58.  
  59.     /* Not set? Only mark the message as no longer sent. */
  60.     if(port==NULL)
  61.     message->mn_Node.ln_Type=NT_FREEMSG;
  62.     else
  63.     {
  64.     /* Mark the message as replied */
  65.     message->mn_Node.ln_Type=NT_REPLYMSG;
  66.  
  67.     /* Add it to the replyport's list */
  68.     AddTail(&port->mp_MsgList,&message->mn_Node);
  69.  
  70.     /* And trigger the arrival action. */
  71.     switch(port->mp_Flags&PF_ACTION)
  72.     {
  73.         case PA_SIGNAL:
  74.         /* Send a signal */
  75.         Signal((struct Task *)port->mp_SigTask,1<<port->mp_SigBit);
  76.         break;
  77.  
  78.         case PA_SOFTINT:
  79.         /* Raise a software interrupt */
  80.         Cause((struct Interrupt *)port->mp_SoftInt);
  81.         break;
  82.  
  83.         case PA_IGNORE:
  84.         /* Do nothing */
  85.         break;
  86.     }
  87.     }
  88.  
  89.     /* All done */
  90.     Enable();
  91.     __AROS_FUNC_EXIT
  92. } /* ReplyMsg */
  93.